<include file="Public/mobile_head"/>	
<link href="{:ADDON_PUBLIC_PATH}/card.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">

<body>
	<div class="container">
    	<a href="http://mp.weixin.qq.com/s?__biz=MzA3MTA3NDM4NA==&mid=209365557&idx=1&sn=eeffc70706561475a5bb3bde8d4a5e4b#rd">
            <img src="{:ADDON_PUBLIC_PATH}/sign_in_pic.jpg" width="100%"/>
        </a>
    	<div class="p_10"> 
            <div class="tb"><a id="checkin" href="javascript:void(0)" class="btn yellow_btn m_10 flex_1">
                <eq name="has_checkin" value="true">你已签到<else/>点击签到，赚微币</eq>
                </a></div>
            <div class="single_item mt_10 p_10">
            	<div class="select_month">
                	<div class="current_month icon_date">
                    	<p class="icon_arrow_down"><span id="cYear"></span>年<span id="cMonth"></span>月份微币明细<br/>
                        <span>点击此处查看其他月份</span></p>
                    </div>
                    <select name="date" id="date" class="score_date mb_10 icon_date">
                        <foreach name="months" item="m">
                            <option value="{:U('detail?year='.$m['year'].'&month='.$m['month'])}">{$m.year}年{$m.month}月</option>
                        </foreach>
                    </select>
                </div>
                <p class="all_score">本月合计：<span id="total_coin"></span>微币，总计：{$coin}微币</p>
                <div class="score_list score_list_top">
                	<span>日期</span>
                    <span>获取情况</span>
                    <span>财富</span>
                </div>
                <!--<foreach name="score_list" item="item">-->
                    <!--<div class="score_list">-->
                        <!--<span>{$item.cTime}</span>-->
                        <!--<span>{$item.title}</span>-->
                        <!--<span>{$item.score} <eq name="item.title" value="线下消费">积分<else/>微币</eq></span>-->
                    <!--</div>-->
                <!--</foreach>-->

            </div>
        </div>
    </div>
    <!--<nav class="bottom_nav">-->
    	<!--<a class="icon_card" href="#">会员卡</a>-->
        <!--<a class="icon_crown" href="#">特权</a>-->
        <!--<a class="icon_tag" href="#">优惠券</a>-->
        <!--<a class="icon_time cur" href="#">签到</a>-->
        <!--<a class="icon_gift" href="#">兑换</a>-->
    <!--</nav>-->
    <div class="bottom_nav_blank"/>
    <script type="text/javascript">
        var _date = $('#date');
        _date.change(function(){
            var scorelist = $('.score_list');
            var tmpl = '<div class="score_list score_list_item">\n    <span></span>\n    <span></span>\n    <span></span>\n</div>'
            $.get($(this).val(), function(data) {
                $('#cYear').text(data.month.year);
                $('#cMonth').text(data.month.month);
                $('.score_list_item').remove();
                $('#total_coin').text(data.total_coin);
//                $('#total_score').text(data.total_score);

                var list = [];
                $.each(data.score_list, function(index,item) {
                    var tmp = $(tmpl);
                    tmp.find('span:eq(0)').text(item.cTime);
                    tmp.find('span:eq(1)').text(item.title);
                    tmp.find('span:eq(2)').text(item.score + (item.title === '线下消费'? '积分':'微币'));
                    list.push(tmp);
                });
                scorelist.after(list);
            });
		});
        _date.get(0).selectedIndex = 4;
        _date.change();
        <if condition="$has_checkin eq 0">
        $('#checkin').click(function() {
            $.post("{:U('show')}", function(resp) {
                if (parseInt(resp) > 0) {
                    $.Dialog.success('签到成功，微币+' + resp);
                    setTimeout(function(){
                        window.location.reload();
                    },2000);

                }
                else if(resp == 0){
                    $.Dialog.fail('签到失败');
                }
                else {
                    $.Dialog.fail(resp);
                }
            });
        });
        </if>
    </script>
</body>
</html>
